package com.example.springboottest.example.classload;

import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;

public class ClassLoadTest {
    public static void main(String[] args) {
        String className = "com.gantang.cust.bommgmt.dto.FindPatternsDto";
        MyClassLoader cl = null;
        while (true) {
            try {
                cl = new MyClassLoader();
                Class<?> _class = cl.loadClass(className);
                System.out.println("_class.toString()\t" + _class.toString());
                Method method = _class.getMethod("say");
                method.invoke(_class.newInstance());
            } catch (Exception ex) {
//                    ex.printStackTrace();
            }
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
